import { getAreaObj, uploadType, regularRule } from '@/utils/util'

import { configToSearch, toSearchHandle } from '@/views/datacenter/business/utils/index'
// const stateDicData = [
// 	{ label: '未完成', value: '0', type: 'danger' },
// 	{ label: '进行中', value: '1', type: 'info' },
// 	{ label: '已完成', value: '2', type: 'success' },
// ]
// 家庭床位申请
export const applyFormConfig: any = {
	inline: false,
	labelPosition: 'left',
	labelWidth: '180px',
	showBtn: true,
	column: [
		{
			type: 'DividerHtml',
			modelValue: '家庭床位申请',
			span: 24,
		},
		{
			label: '申请材料',
			prop: 'applyMaterials',
			type: 'upload',
			fileType: uploadType.fileMetaType,
			listType: 'text',
			showFileList: true,
			changeField: true,
			limit: 1,
			multiple: true,
			span: 12,
			rules: [{ required: true, message: '请输入申请材料' }],
		},
		{
			label: '申请时间',
			prop: 'applyTime',
			type: 'date',
			format: 'YYYY年MM月DD日',
			valueFormat: 'YYYY-MM-DD',
			span: 12,
			rules: [{ required: true, message: '请输入申请时间' }],
		},
		{
			label: '申请受理单位名称',
			prop: 'acceptUnitName',
			type: 'text',
			maxlength: '50',
			showWordLimit: true,
			span: 12,
			rules: [{ required: true, message: '请输入申请受理单位名称' }],
		},
		{
			label: '申请受理人姓名',
			prop: 'acceptName',
			type: 'text',
			maxlength: '20',
			showWordLimit: true,
			span: 12,
			rules: [{ required: true, message: '请输入申请受理人姓名' }],
		},
		{
			label: '申请受理时间',
			prop: 'acceptTime',
			type: 'datetime',
			format: 'YYYY年MM月DD HH:mm:ss',
			valueFormat: 'YYYY-MM-DD HH:mm:ss',
			span: 12,
			rules: [{ required: true, message: '请输入申请受理时间' }],
		},
		{
			label: '申请受理结果',
			prop: 'applyResult',
			propName: 'applyResultLabel',
			type: 'remoteSelect',
			api: 'getDictItemList',
			code: 'RESULT',
			filterKey: 'value',
			multiple: false,
			span: 12,
			rules: [{ required: true, message: '请输入申请受理结果' }],
		},
		{
			label: '申请档案状态',
			prop: 'applyState',
			propName: 'applyStateLabel',
			type: 'remoteSelect',
			code: 'ARCHIVES_STATUS',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			span: 12,
			rules: [{ required: true, message: '请输入申请档案状态' }],
		},
	],
}
// 家庭床位评估
export const assessFormConfig: any = {
	inline: false,
	labelPosition: 'left',
	labelWidth: '180px',
	showBtn: true,
	column: [
		{
			type: 'DividerHtml',
			modelValue: '家庭床位评估',
			span: 24,
		},
		{
			label: '能力等级',
			prop: 'assessAbilityLevel',
			propName: 'assessAbilityLevelLabel',
			type: 'remoteSelect',
			api: 'getDictItemList',
			code: 'ACCESS_LEVEL_COUNTRY',
			filterKey: 'value',
			multiple: false,
			span: 12,
			rules: [{ required: true, message: '请输入能力等级' }],
		},
		{
			label: '评估单位名称',
			prop: 'assessUnitName',
			type: 'text',
			maxlength: '50',
			showWordLimit: true,
			span: 12,
			rules: [{ required: true, message: '请输入评估单位名称' }],
		},
		{
			label: '评估单位统一信用代码',
			prop: 'assessCreditCode',
			type: 'text',
			maxlength: '50',
			showWordLimit: true,
			span: 12,
			rules: [
				{ required: true, message: '请输入评估单位统一信用代码' },
				{ pattern: regularRule.code, message: '请输入正确评估单位统一信用代码' },
			],
		},
		{
			label: '评估人姓名',
			prop: 'assessName',
			type: 'text',
			maxlength: '20',
			showWordLimit: true,
			span: 12,
			rules: [{ required: true, message: '请输入评估人姓名' }],
		},
		{
			label: '评估时间',
			prop: 'assessTime',
			type: 'datetime',
			format: 'YYYY年MM月DD日 HH时mm分ss秒',
			valueFormat: 'YYYY-MM-DD HH:mm:ss',
			span: 12,
			rules: [{ required: true, message: '请输入评估时间' }],
		},
		{
			label: '评估材料',
			prop: 'assessMaterials',
			type: 'upload',
			fileType: uploadType.fileMetaType,
			listType: 'text',
			showFileList: true,
			changeField: true,
			limit: 1,
			multiple: true,
			span: 12,
			rules: [{ required: true, message: '请输入评估材料' }],
		},
		{
			label: '评估档案状态',
			prop: 'assessState',
			propName: 'assessStateLabel',
			type: 'remoteSelect',
			code: 'ARCHIVES_STATUS',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			span: 12,
			rules: [{ required: true, message: '请输入评估档案状态' }],
		},
	],
}
// 家庭床位签约
export const signedFormConfig: any = {
	inline: false,
	labelPosition: 'left',
	labelWidth: '180px',
	showBtn: true,
	column: [
		// 家庭床位签约
		{
			type: 'DividerHtml',
			modelValue: '家庭床位签约',
			span: 24,
		},
		{
			label: '签约机构名名称',
			prop: 'orgName',
			type: 'text',
			maxlength: '50',
			showWordLimit: true,
			span: 12,
			rules: [{ required: true, message: '请输入签约机构名名称' }],
		},
		{
			label: '签约机构统一信用代码',
			prop: 'creditCode',
			type: 'text',
			maxlength: '50',
			showWordLimit: true,
			span: 12,
			rules: [
				{ required: true, message: '请输入签约机构名名称' },
				{ pattern: regularRule.code, message: '请输入正确签约机构统一信用代码' },
			],
		},
		{
			label: '签约时间',
			prop: 'signedTime',
			type: 'datetime',
			format: 'YYYY年MM月DD日 HH时mm分ss秒',
			valueFormat: 'YYYY-MM-DD HH:mm:ss',
			span: 12,
			rules: [{ required: true, message: '请输入签约时间' }],
		},
		{
			label: '签约时长',
			prop: 'signedDuration',
			type: 'text',
			append: '天',
			rules: [
				{ required: true, message: '请输入签约时长' },
				{ validator: regularRule.number, message: '请输入正确的签约时长' },
			],
			span: 12,
		},
		{
			label: '签约价格',
			prop: 'signedPrice',
			type: 'text',
			append: '元',
			rules: [
				{ required: true, message: '请输入签约价格' },
				{ validator: regularRule.number, message: '请输入正确的签约价格' },
			],
			span: 12,
		},
		{
			label: '签约材料',
			prop: 'signedMaterials',
			type: 'upload',
			fileType: uploadType.fileMetaType,
			listType: 'text',
			showFileList: true,
			changeField: true,
			limit: 1,
			multiple: true,
			span: 12,
			rules: [{ required: true, message: '请输入签约材料' }],
		},
		{
			label: '签约档案状态',
			prop: 'signState',
			propName: 'signStateLabel',
			type: 'remoteSelect',
			code: 'ARCHIVES_STATUS',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			span: 12,
			rules: [{ required: true, message: '请输入签约档案状态' }],
		},
	],
}
// 家庭床位改造
export const reformFormConfig: any = {
	inline: false,
	labelPosition: 'left',
	labelWidth: '180px',
	showBtn: true,
	column: [
		{
			type: 'DividerHtml',
			modelValue: '家庭床位改造',
			span: 24,
		},
		{
			label: '改造单位名称',
			prop: 'remouldUnitName',
			type: 'text',
			maxlength: '50',
			showWordLimit: true,
			span: 12,
			rules: [{ required: true, message: '请输入改造单位名称' }],
		},
		{
			label: '改造单位统一信用代码',
			prop: 'remouldCreditCode',
			type: 'text',
			maxlength: '50',
			showWordLimit: true,
			span: 12,
			rules: [
				{ required: true, message: '请输入改造单位统一信用代码' },
				{ pattern: regularRule.code, message: '请输入正确改造单位统一信用代码' },
			],
		},
		{
			label: '改造时间',
			prop: 'remouldTime',
			type: 'date',
			format: 'YYYY年MM月DD日',
			valueFormat: 'YYYY-MM-DD',
			span: 12,
			rules: [{ required: true, message: '请输入改造时间' }],
		},
		{
			label: '改造人',
			prop: 'remouldName',
			type: 'text',
			maxlength: '20',
			showWordLimit: true,
			span: 12,
			rules: [{ required: true, message: '请输入改造人名称' }],
		},
		{
			label: '改造实际金额',
			prop: 'actualAmount',
			type: 'text',
			append: '元',
			rules: [
				{ required: true, message: '请输入改造实际金额' },
				{ validator: regularRule.number, message: '请输入正确的改造实际金额' },
			],
			span: 12,
		},
		{
			label: '改造标准金额',
			prop: 'standardAmount',
			type: 'text',
			append: '元',
			rules: [
				{ required: true, message: '请输入改造标准金额' },
				{ validator: regularRule.number, message: '请输入正确的改造标准金额' },
			],
			span: 12,
		},
		{
			label: '改造前后对比档案',
			prop: 'comparison',
			type: 'upload',
			fileType: uploadType.fileMetaType,
			listType: 'text',
			showFileList: true,
			changeField: true,
			limit: 1,
			multiple: true,
			span: 24,
			rules: [{ required: true, message: '请输入改造前后对比档案' }],
		},
		{
			label: '改造档案状态',
			prop: 'remouldState',
			propName: 'remouldStateLabel',
			type: 'remoteSelect',
			code: 'ARCHIVES_STATUS',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			span: 12,
			rules: [{ required: true, message: '请输入签约档案状态' }],
		},
	],
}
// 家庭床位验收
export const acceptFormConfig: any = {
	inline: false,
	labelPosition: 'left',
	labelWidth: '180px',
	showBtn: true,
	column: [
		{
			type: 'DividerHtml',
			modelValue: '家庭床位验收',
			span: 24,
		},
		{
			label: '验收单位名称',
			prop: 'acceptanceUnitName',
			type: 'text',
			maxlength: '50',
			showWordLimit: true,
			span: 12,
			rules: [{ required: true, message: '请输入验收单位名称' }],
		},
		{
			label: '验收单位统一信用代码',
			prop: 'acceptanceCreditCode',
			type: 'text',
			maxlength: '50',
			showWordLimit: true,
			span: 12,
			rules: [
				{ required: true, message: '请输入验收单位统一信用代码' },
				{ pattern: regularRule.code, message: '请输入正确验收单位统一信用代码' },
			],
		},
		{
			label: '验收日期',
			prop: 'acceptanceDate',
			type: 'date',
			format: 'YYYY年MM月DD日',
			valueFormat: 'YYYY-MM-DD',
			span: 12,
			rules: [{ required: true, message: '请输入验收日期' }],
		},
		{
			label: '验收人',
			prop: 'acceptanceName',
			type: 'text',
			maxlength: '20',
			showWordLimit: true,
			span: 12,
			rules: [{ required: true, message: '请输入验收人名称' }],
		},
		{
			label: '验收材料',
			prop: 'acceptanceMaterials',
			type: 'upload',
			fileType: uploadType.fileMetaType,
			listType: 'text',
			showFileList: true,
			changeField: true,
			limit: 1,
			multiple: true,
			span: 12,
			rules: [{ required: true, message: '请输入验收材料' }],
		},
		{
			label: '验收档案状态',
			prop: 'acceptanceState',
			propName: 'acceptanceStateLabel',
			type: 'remoteSelect',
			code: 'ARCHIVES_STATUS',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			span: 12,
			rules: [{ required: true, message: '请输入验收档案状态' }],
		},
	],
}
// 基础数据
export const baseDataConfig: any = {
	inline: false,
	labelPosition: 'left',
	labelWidth: '180px',
	showBtn: true,
	column: [
		{
			type: 'DividerHtml',
			modelValue: '家庭养老床位建设档案',
			span: 24,
		},
		{
			label: '家庭床位用户姓名',
			prop: 'name',
			type: 'text',
			maxlength: '20',
			showWordLimit: true,
			span: 12,
			rules: [{ required: true, message: '请输入家庭床位用户姓名' }],
		},
		{
			label: '家庭床位用户身份证号',
			prop: 'idCard',
			type: 'text',
			changeField: true,
			maxlength: '18',
			showWordLimit: true,
			span: 12,
			rules: [
				{ required: true, message: '请输入家庭床位用户身份证号' },
				{ pattern: regularRule.idCard, message: '请输入正确家庭床位用户身份证号' },
			],
		},
		{
			label: '家庭床位用户联系电话',
			prop: 'phone',
			type: 'text',
			maxlength: '11',
			showWordLimit: true,
			span: 12,
			rules: [
				{ required: true, message: '请输入家庭床位用户联系电话' },
				{ pattern: regularRule.phone, message: '请输入正确家庭床位用户联系电话' },
			],
		},
		{
			label: '家庭床位用户能力等级',
			prop: 'abilityLevel',
			propName: 'abilityLevelLabel',
			type: 'remoteSelect',
			api: 'getDictItemList',
			code: 'ACCESS_LEVEL_COUNTRY',
			filterKey: 'value',
			multiple: false,
			span: 12,
			rules: [{ required: true, message: '请输入家庭床位用户能力等级' }],
		},
		{
			label: '家庭床位用户类别',
			prop: 'userType',
			propName: 'userTypeLabel',
			type: 'remoteSelect',
			api: 'getDictItemList',
			code: 'ELDERLY_TYPE',
			filterKey: 'value',
			multiple: false,
			span: 12,
			rules: [{ required: true, message: '请输入家庭床位用户类别' }],
		},
		{
			label: '经济困难类型',
			prop: 'difficultyType',
			propName: 'difficultyTypeLabel',
			type: 'remoteSelect',
			api: 'getDictItemList',
			code: 'COMMON_FLAG',
			filterKey: 'value',
			multiple: false,
			span: 12,
			rules: [{ required: true, message: '请输入经济困难类型' }],
		},
		{
			label: '经济困难证明材料',
			prop: 'proofMaterial',
			type: 'upload',
			showFileList: false,
			limit: 4,
			multiple: false,
			changeField: true,
			span: 12,
			rules: [{ required: true, message: '经济困难证明材料' }],
		},
		{
			label: '家庭床位用户户籍地区',
			prop: 'cr_areas',
			propName: 'cr_areas_name',
			type: 'AplidAreaSelect',
			changeField: true,
			span: 12,
			rules: [{ required: true, message: '请选择家庭床位用户户籍地区' }],
		},
		{
			label: '家庭床位用户户籍地址',
			prop: 'crAddress',
			type: 'text',
			maxlength: '50',
			showWordLimit: true,
			span: 12,
			rules: [{ required: true, message: '请输入家庭床位用户户籍地址' }],
		},
		{
			label: '家庭床位用户现居地区',
			prop: 'areas',
			propName: 'areas_name',
			type: 'AplidAreaSelect',
			changeField: true,
			span: 12,
			rules: [{ required: true, message: '请选择家庭床位用户现居地区' }],
		},
		{
			label: '家庭床位用户现居地址',
			prop: 'address',
			type: 'text',
			maxlength: '50',
			showWordLimit: true,
			span: 12,
			rules: [{ required: true, message: '请输入家庭床位用户现居地址' }],
		},
		{
			label: '是否家庭床位提升行动',
			prop: 'promoteAction',
			propName: 'promoteActionLabel',
			type: 'remoteSelect',
			api: 'getDictItemList',
			code: 'COMMON_FLAG',
			filterKey: 'value',
			multiple: false,
			span: 12,
			rules: [{ required: true, message: '请输入是否家庭床位提升行动' }],
		},
		{
			label: '家庭床位用户联系人姓名',
			prop: 'contactName',
			type: 'text',
			maxlength: '20',
			showWordLimit: true,
			span: 12,
			rules: [{ required: true, message: '请输入家庭床位用户联系人姓名' }],
		},
		{
			label: '家庭床位用户联系人电话',
			prop: 'contactPhone',
			type: 'text',
			maxlength: '11',
			showWordLimit: true,
			span: 12,
			rules: [
				{ required: true, message: '请输入家庭床位用户联系人电话' },
				{ pattern: regularRule.phone, message: '请输入正确家庭床位用户联系人电话' },
			],
		},
		{
			label: '家庭床位用户联系人与其关系',
			prop: 'relationship',
			propName: 'relationshipLabel',
			type: 'remoteSelect',
			api: 'getDictItemList',
			code: 'ELDERLY_RELATIONSHIP',
			filterKey: 'value',
			multiple: false,
			span: 12,
			rules: [{ required: true, message: '请输入家庭床位用户联系人与其关系' }],
		},
		{
			label: '家庭床位用户评估方',
			prop: 'userAppraiser',
			type: 'text',
			maxlength: '50',
			showWordLimit: true,
			span: 12,
		},
		{
			label: '家庭床位用户建设方',
			prop: 'userConstruction',
			type: 'text',
			maxlength: '50',
			showWordLimit: true,
			span: 12,
		},
		{
			label: '家庭床位用户服务方',
			prop: 'userService',
			type: 'text',
			maxlength: '50',
			showWordLimit: true,
			span: 12,
		},
		{
			label: '家床老人汇总表',
			prop: 'summary',
			type: 'upload',
			fileType: uploadType.fileMetaType,
			listType: 'text',
			showFileList: true,
			changeField: true,
			limit: 1,
			multiple: true,
			span: 12,
		},
	],
}
// applyFormConfig.column.forEach((el) => {
// 	el.rules = undefined
// })
// assessFormConfig.column.forEach((el) => {
// 	el.rules = undefined
// })
// signedFormConfig.column.forEach((el) => {
// 	el.rules = undefined
// })
// reformFormConfig.column.forEach((el) => {
// 	el.rules = undefined
// })
// acceptFormConfig.column.forEach((el) => {
// 	el.rules = undefined
// })
// baseDataConfig.column.forEach((el) => {
// 	el.rules = undefined
// })

const formConfig: any = {
	inline: false,
	labelPosition: 'top',
	labelWidth: '180px',
	showBtn: true,
	column: [
		...baseDataConfig.column,
		...applyFormConfig.column,
		...assessFormConfig.column,
		...signedFormConfig.column,
		...reformFormConfig.column,
		...acceptFormConfig.column,
	],
}

const handle = (config) => {
	let column = JSON.parse(JSON.stringify(config.column))
	column.forEach((el, index) => {
		if (el.custome == 'divider') {
			column.splice(index, 1)
		}
		if (el.type != 'DividerHtml') {
			el.span = 8
		}
	})
	return column
}
const moreSearchConfig: any = {
	inline: true,
	showBtn: false,
	labelPosition: 'left',
	column: [...configToSearch(formConfig.column)],
}

// 处理为详情需要的数据
export const baseDataColumnDetail: any = {
	inline: true,
	showBtn: false,
	column: handle(baseDataConfig),
}
export const applyFormColumnDetail: any = {
	inline: true,
	showBtn: false,
	column: handle(applyFormConfig),
}
export const assessFormConfigDetail: any = {
	inline: true,
	showBtn: false,
	column: handle(assessFormConfig),
}
export const signedFormConfigDetail: any = {
	inline: true,
	showBtn: false,
	column: handle(signedFormConfig),
}
export const reformFormConfigDetail: any = {
	inline: true,
	showBtn: false,
	column: handle(reformFormConfig),
}
export const acceptFormConfigDetail: any = {
	inline: true,
	showBtn: false,
	column: handle(acceptFormConfig),
}

const tableConfig = {
	stripe: true,
	border: true,
	maxHeight: '80vh',
	columns: [
		{ label: '所属区', prop: 'crAreaName' },
		{ label: '姓名', prop: 'name' },
		{ label: '证件号码', prop: 'idCard', plusXing: '2,2' },
		{
			label: '提升行动',
			prop: 'promoteAction',
			propName: 'promoteActionLabel',
			type: 'remoteSelect',
			api: 'getDictItemList',
			code: 'COMMON_FLAG',
		},
		{ label: '联系方式', prop: 'phone', plusXing: '5,2' },
		{
			label: '经济困难',
			prop: 'difficultyType',
			propName: 'difficultyTypeLabel',
			type: 'remoteSelect',
			api: 'getDictItemList',
			code: 'COMMON_FLAG',
		},
		{
			label: '类别',
			prop: 'userType',
			propName: 'userTypeLabel',
			type: 'remoteSelect',
			api: 'getDictItemList',
			code: 'ELDERLY_TYPE',
		},
		{
			label: '能力等级',
			prop: 'abilityLevel',
			propName: 'abilityLevelLabel',
			type: 'remoteSelect',
			api: 'getDictItemList',
			code: 'ACCESS_LEVEL_COUNTRY',
		},
		{
			label: '申请档案',
			prop: 'applyState',
			propName: 'applyStateLabel',
			code: 'ARCHIVES_STATUS',
			api: 'getDictItemList',
			type: 'remoteSelect',
		},
		{
			label: '评估档案',
			prop: 'assessState',
			propName: 'assessStateLabel',
			code: 'ARCHIVES_STATUS',
			api: 'getDictItemList',
			type: 'remoteSelect',
		},
		{
			label: '签约档案',
			prop: 'signState',
			propName: 'signStateLabel',
			code: 'ARCHIVES_STATUS',
			api: 'getDictItemList',
			type: 'remoteSelect',
		},
		{
			label: '改造档案',
			prop: 'remouldState',
			propName: 'remouldStateLabel',
			code: 'ARCHIVES_STATUS',
			api: 'getDictItemList',
			type: 'remoteSelect',
		},
		{
			label: '验收档案',
			prop: 'acceptanceState',
			propName: 'acceptanceStateLabel',
			code: 'ARCHIVES_STATUS',
			api: 'getDictItemList',
			type: 'remoteSelect',
		},
		{
			label: '是否可信',
			prop: 'isBelievable',
			custome: 'tag',
			dicData: [
				{ label: '否', value: 0, type: 'danger' },
				{ label: '是', value: 1, type: 'success' },
			],
		},
		{
			label: '操作',
			prop: 'menu',
			width: 300,
			fixed: 'right',
		},
	],
}

export const baseSearchConfig = {
	inline: true,
	showBtn: false,
	labelPosition: 'left',
	column: [
		{
			label: '姓名',
			prop: 'name',
			type: 'input',
			span: 24,
		},
	],
}
export const detailConfig = {
	inline: false,
	labelPosition: 'left',
	labelWidth: '220px',
	column: baseDataConfig.column,
}
export const baseConfig: any = {
	pageName: '家庭养老床位建设档案',
	dictcodes: ['ARCHIVES_STATUS', 'ACCESS_LEVEL_COUNTRY', 'ELDERLY_TYPE', 'ECONOMIC_SITUATION', 'COMMON_FLAG', 'ELDERLY_RELATIONSHIP', 'RESULT'],
	rowKey: 'id',
	addLabel: '添加',
	tipLabel: 'name',
	exportMqTopic: '/ning/export/',
	api: {
		moreSearch: 'view_dpFamilyConstructionArchives_search',
		index: 'dpFamilyConstructionArchives_page',
		edit: 'dpFamilyConstructionArchives_edit',
		add: 'dpFamilyConstructionArchives_add',
		export: 'dpFamilyConstructionArchives_export',
		import: 'dpFamilyConstructionArchives_downloadTemplate',
		delete: 'dpFamilyConstructionArchives_del',
	},
	auth: {
		index: 'view_dpFamilyConstructionArchives_page',
		add: 'view_dpFamilyConstructionArchives_add',
		edit: 'view_dpFamilyConstructionArchives_edit',
		export: 'view_dpFamilyConstructionArchives_export',
		import: 'view_dpFamilyConstructionArchives_downloadTemplate',
		delete: 'view_dpFamilyConstructionArchives_del',
		mulitSet: 'mulitSet',
	},
	paramsObj: {
		code: 2021,
	},
	menuBtn: [
		{
			icon: 'detail',
			label: '查看档案',
			type: 'primary',
			operate: 'Archives',
			auth: 'view_dpFamilyConstructionArchives_page',
			text: true,
			show: true,
		},
		{
			icon: 'editor',
			label: '编辑',
			type: 'primary',
			operate: 'edit',
			auth: 'view_dpFamilyConstructionArchives_edit',
			text: true,
			show: true,
		},
		{
			icon: 'delete',
			label: '删除',
			type: 'danger',
			operate: 'delete',
			auth: 'view_dpFamilyConstructionArchives_del',
			text: true,
			show: true,
		},
	],
	formConfig,
	dialogConfig: {
		width: '85%',
	},
	moreSearchConfig,
	searchConfig: {
		inline: true,
		showBtn: true,
		labelPosition: 'left',
		column: [
			{
				label: '证件号码',
				prop: 'idCard',
				type: 'input',
				span: 6,
			},
			{
				label: '姓名',
				prop: 'name',
				type: 'input',
				span: 6,
			},
			{
				label: '联系方式',
				prop: 'phone',
				type: 'input',
				span: 6,
			},
			{
				label: '所属区',
				propName: 'cr_areas_name',
				type: 'AplidAreaSelect',
				span: 6,
			},
			{
				label: '经济困难',
				prop: 'difficultyType',
				propName: 'difficultyTypeLabel',
				type: 'remoteSelect',
				api: 'getDictItemList',
				code: 'COMMON_FLAG',
				filterKey: 'value',
				multiple: false,
				span: 6,
			},
			{
				label: '类别',
				prop: 'userType',
				propName: 'userTypeLabel',
				type: 'remoteSelect',
				api: 'getDictItemList',
				code: 'ELDERLY_TYPE',
				filterKey: 'value',
				multiple: false,
				span: 6,
			},
			{
				label: '能力等级',
				prop: 'abilityLevel',
				propName: 'abilityLevelLabel',
				type: 'remoteSelect',
				api: 'getDictItemList',
				code: 'ACCESS_LEVEL_COUNTRY',
				filterKey: 'value',
				multiple: false,
				span: 6,
			},
			{
				label: '是否完成',
				prop: 'isComplete',
				propName: 'isCompleteLabel',
				type: 'remoteSelect',
				api: 'getDictItemList',
				code: 'COMMON_FLAG',
				filterKey: 'value',
				span: 6,
			},
		],
	},
	tableConfig,
	saveFormate: async (form) => {
		console.log('参数', form)
		const crAreasName = getAreaObj(form.cr_areas_name, 'cr')
		const crAreas = getAreaObj(form.cr_areas, 'cr')
		const areasName = getAreaObj(form.areas_name, '')
		const Areas = getAreaObj(form.areas, '')
		return new Promise((resolve, reject) => {
			resolve({
				...form,
				...crAreasName,
				...crAreas,
				...areasName,
				...Areas,
				cr_areas_name: undefined,
				cr_areas: undefined,
				areas_name: undefined,
				areas: undefined,
			})
		})
	},
	beforeOnLoadFormate: async (params) => {
		console.log('数据23', params)
		const crAreasName = getAreaObj(params.cr_areas_name, 'cr')
		const crAreas = getAreaObj(params.cr_areas, 'cr')
		const areasName = getAreaObj(params.areas_name, '')
		// 全字段搜索
		params = toSearchHandle(moreSearchConfig, {}, params)
		const Areas = getAreaObj(params.areas, '')
		return Promise.resolve({
			...params,
			...crAreasName,
			...crAreas,
			...areasName,
			...Areas,
			cr_areas_name: undefined,
			cr_areas: undefined,
			areas_name: undefined,
			areas: undefined,
		})
	},
	onLoadFormate: async (arr) => {
		console.log('列表', arr)
		const tableData = arr.map((item) => {
			const areasObj: any = getAreaObj(item, '', 'set')
			const crAreasObj: any = getAreaObj(item, 'cr', 'set')
			return {
				...item,
				areasName: areasObj.names,
				areas: areasObj.areaIds,
				cr_areas: crAreasObj.areaIds,
			}
		})
		return Promise.resolve(Object.freeze(tableData))
	},
}
